﻿using HAF.OfficeEx;
using MediaUtility.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MediaUtility
{
    public partial class FrmOfficer : Form
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public FrmOfficer()
        {
            InitializeComponent();
        }

        private void btnRead_ClickAsync(object sender, EventArgs e)
        {
            string abc = DateTime.Now.Date.ToString("yyyy/bqxx/MM/MMdd").Replace("/","\\");
            string fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, abc);
            string resPath = txtFiles.Text;
            string[] colNames = AuthorizationFilesDto.ToArrayString();
            //AuthorizationFilesDto
            //ReadFile(resPath, colNames);

            IList<AuthorizationFilesDto> fileData = ExcelEx.ReadExcelToObject<AuthorizationFilesDto>(resPath, colNames, 1);
            if (fileData != null && fileData.Count > 0)
            {
                //abc.CopyTo(AuthorizationFilesDto)
            }
        }


        private async Task ReadFile(string resPath, string[] colNames)
        {
            //IList<AuthorizationFilesDto> abc = await ExcelEx.ReadExcelToObject<AuthorizationFilesDto>(resPath, colNames, 1);
            //if (abc != null)
            //{
            //    //abc.CopyTo(AuthorizationFilesDto)
            //}

        }
    }
}
